# -*- coding: utf-8 -*-
from skimage import data
from matplotlib import pyplot as plt 
import numpy as np#载入所需类包
image=data.coffee()#载入测试图像
#plt.imshow(image)
print(image.shape)#显示图像原始大小
print(type(image))#显示图像类型
ratio=20#设置采样比率
image1=np.zeros((int(image.shape[0]/ratio),int(image.shape[1]/ratio),image.shape[2]),dtype='int32')
for i in range(image1.shape[0]):
    for j in range(image1.shape[1]):
        for k in range(image1.shape[2]):
            delta=image[i*ratio:(i+1)*ratio,j*ratio:(j+1)*ratio,k]
            image1[i,j,k]=np.max(delta)
plt.imshow(image1)
plt.show()
    

